package org.restrpc.examples;

import org.restrpc.client.RpcClient;
import org.restrpc.client.NativeRpcClient;

import java.util.concurrent.TimeUnit;

public class PubSubExample
{
    public static void main(String[] args) throws InterruptedException {
        // Create a RPC client instance.
    	RpcClient rpcClient = new NativeRpcClient("D:/workspace/LowCode/magic-api-r2r/lib");
        // Connect to the C++ RPC server which is listening on `127.0.0.1:9000`.
        //rpcClient.loadLib("D:/workspace/LowCode/magic-api-r2r/lib");
        rpcClient.connect("127.0.0.1:9000");
        System.out.println("connect success");
//        rpcClient.subscribe((channel, message) ->
//        {
////            Codec codec = new Codec();
////           Person per = codec.decodeReturnValue(message.getBytes());
//            // todo 解码操作
//            System.out.println(channel +  " receive message:" +message);
//        }, "key");
        TimeUnit.SECONDS.sleep(10);
    }
}
